package com.atguigu.order.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class OrderOnUtil {
//    public static void main(String[] args) {
//        System.out.println(getOrderNo());
//    }
    //生成订单号
    public static String getOrderNo() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String format = sdf.format(new Date());
        Random random = new Random();
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < 4; i++){
            result.append(random.nextInt(10));
        }

//        return System.currentTimeMillis()+""+((int)(Math.random()*100));
        return  format + result;
    }
}
